export const usePaging = (props) => {
    const dataList = ref([]);
    const searchParam = ref({})
    const paging = ref(null)
    const queryList = (page, limit) => {
        props.listApi({
            page,
            pageSize: limit,
            ...searchParam.value,
            ...props.otherParam
        }).then(res => {
            paging.value.complete(res.result.items);
        }).catch(err => {
            paging.value.complete(false);
        })
    }
    const searchData = () => {
        paging.value.reload();
    }
    return {
        dataList,
        searchParam,
        paging,
        queryList,
        searchData,
    }
}